UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A2qsssxT8j6xdy30PcCaFPUmWtNUk9bZGOYgkNM0H1Q=' 
WHERE 
  key_id = '2736ab56c14ae60c981858564674e5d4ec224f88272288a8057c058506411a07' 
  AND (
    token = 'A2qsssxT8j6xdy30PcCaFPUmWtNUk9bZGOYgkNM0H1Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032