UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qc660M48nQJRIO8hwixWY+sAUy/5QtHtNMFPgrLXjL8=' 
WHERE 
  key_id = '67ac732ba7fe97d8d96febf4eec0e32cf3a381888fb9349858e12af719b2ce59' 
  AND (
    token = 'qc660M48nQJRIO8hwixWY+sAUy/5QtHtNMFPgrLXjL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043