UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8dBr7XAVFxpIkIrekgD4hYzClR5sN9o9sN2djweGdVM=' 
WHERE 
  key_id = 'da3d7876d22dc3aa65bed6332106f86b30a4b2881c064e52778d497ee7783baa' 
  AND (
    token = '8dBr7XAVFxpIkIrekgD4hYzClR5sN9o9sN2djweGdVM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026