UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SCKvEpJ8HNPTceO4pxOrW87LmFmVvJKTWlanKfpgoxc=' 
WHERE 
  key_id = '659791b223e7ae90a9bb8ac369aa37e4f04fd01e5ba5692f996753e77bf36071' 
  AND (
    token = 'SCKvEpJ8HNPTceO4pxOrW87LmFmVvJKTWlanKfpgoxc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00077