UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tyqk8N/1jB/kTxhFoYKh0dp4ZNTcFfHnQz1kWdgM3Sk=' 
WHERE 
  key_id = 'a14eaaa16025580454b93f74932e00f25306d1b037d74ce1a40afe56f0ead942' 
  AND (
    token = 'Tyqk8N/1jB/kTxhFoYKh0dp4ZNTcFfHnQz1kWdgM3Sk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026