UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KsvVT+nJw0JxBhy+rXf2Lmr2uFmqtlmHCV5uEZsuTDk=' 
WHERE 
  key_id = 'e6b45e52809efc6c4f5a2a4cd27030620ca627325139a4790cec2cf5c77b7376' 
  AND (
    token = 'KsvVT+nJw0JxBhy+rXf2Lmr2uFmqtlmHCV5uEZsuTDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033