UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '65mi7RFypm2gUXA22lW1Qg/zmLLnKkSGaoPyMSb2tco=' 
WHERE 
  key_id = 'e517ffc758cec9bae39f5c39ee27c8aca73e4a9dca204661d7c338b5a3aec80a' 
  AND (
    token = '65mi7RFypm2gUXA22lW1Qg/zmLLnKkSGaoPyMSb2tco=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028