UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xS/uNYPhEo7SlEa1c/ve5PCy2AHgEKhMFKa+6KOMLKw=' 
WHERE 
  key_id = '30e258fdc104ceb1e0e947ee8019b58e8569421c287643268184afeb8e7f0c80' 
  AND (
    token = 'xS/uNYPhEo7SlEa1c/ve5PCy2AHgEKhMFKa+6KOMLKw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028