UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lPK9TlkMhTziXFODFbF0BnMYFxuRHO6OIe809nB6vXs=' 
WHERE 
  key_id = '0f1fe152156f46288a67a8e13c598cc6dbb234fd50f62d9a28f6db9154b054a5' 
  AND (
    token = 'lPK9TlkMhTziXFODFbF0BnMYFxuRHO6OIe809nB6vXs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029