UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9KePEWbT3wz5emhr1QVU8CjBEeFIUwtQ34xQaAGDemk=' 
WHERE 
  key_id = 'e3144f9eda0aa5f5de0661c94a53d02538546781e5bfa0d505d569b94ea861a1' 
  AND (
    token = '9KePEWbT3wz5emhr1QVU8CjBEeFIUwtQ34xQaAGDemk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039