UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dH7t//iigwazsRIz/vpgdQ3mVDSexaVxIJWh/ix1fyY=' 
WHERE 
  key_id = 'e5de886f11eb0c9b6f9d2b49292eb67477f49f49b2538f65dea0b518353a5041' 
  AND (
    token = 'dH7t//iigwazsRIz/vpgdQ3mVDSexaVxIJWh/ix1fyY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032