UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CzQst4qycVG14CABJaiFbJS4ref/KxQi6g7xr4g32o0=' 
WHERE 
  key_id = 'c81efc743d24a96711f32f6b99f16c27a6a4242da1eae6612d51c9f3105064f6' 
  AND (
    token = 'CzQst4qycVG14CABJaiFbJS4ref/KxQi6g7xr4g32o0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025