UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VXrAGm3QT+mWAgjjHie49HLLoDnTm8N/WaxT19uokqQ=' 
WHERE 
  key_id = '970c7b973526b8799ad1bd1802ffebbe0d6df629cfb4bd639474c6169f9f4880' 
  AND (
    token = 'VXrAGm3QT+mWAgjjHie49HLLoDnTm8N/WaxT19uokqQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030