UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lx/KdMq4lTKM3jy4Kt9nc8DVycQhj3Z44H9HwXf7CKM=' 
WHERE 
  key_id = '584c974e14993170533d96ba23394c7906bff759fb8d62af463e96785fbae057' 
  AND (
    token = 'Lx/KdMq4lTKM3jy4Kt9nc8DVycQhj3Z44H9HwXf7CKM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037