UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xZEMNjbbwmI9HLfnfiYy6AbBhFjIAJWqCN6jDtcdS6U=' 
WHERE 
  key_id = '549104dd308e72131d682b183109df314cd178be92ca2955b62b0fa22a1866c0' 
  AND (
    token = 'xZEMNjbbwmI9HLfnfiYy6AbBhFjIAJWqCN6jDtcdS6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038