UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PgSiUxra5LgBM5offhsDtPCqMUMDgzaN29SW8A2dvwM=' 
WHERE 
  key_id = 'd017fc71d2f73b6e00d5c4efd6202ac1f80fd1088a75714ee8b447c261630a2c' 
  AND (
    token = 'PgSiUxra5LgBM5offhsDtPCqMUMDgzaN29SW8A2dvwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037