UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DQwR2sCstt2QmRauFfDr0xQT1vhyeSvAYpHadJqNt2Y=' 
WHERE 
  key_id = '96463cf44fe8435c40d5cfe8683b0bf69dd2443fca207a86fb7e4a0062a707b1' 
  AND (
    token = 'DQwR2sCstt2QmRauFfDr0xQT1vhyeSvAYpHadJqNt2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035