UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7wLWkOW1vggxaOnU1+T4Z+YxxMfb54o9G2PXz6nRR2o=' 
WHERE 
  key_id = '51671792fa4321d6d31e53b8d7745d0e82c28fd48df3e9766dc2d7a7c38e9f24' 
  AND (
    token = '7wLWkOW1vggxaOnU1+T4Z+YxxMfb54o9G2PXz6nRR2o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046