UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'daT2xm/VMucxQEoE9Asr8y4DhtF9qmYvplcswOdkwXU=' 
WHERE 
  key_id = 'f77cc307676e2489d6a90578c899964e51a8b56d8d0e11e6b5bc21da88f01a21' 
  AND (
    token = 'daT2xm/VMucxQEoE9Asr8y4DhtF9qmYvplcswOdkwXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043