UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '38en7+KOuYtev3DO1QAWbShR/fsmr9nV3yMYCliyiMQ=' 
WHERE 
  key_id = '65db182549b7cb9d1dc6376a66f47f5bde340dae71d6780c83fe2797d4044a85' 
  AND (
    token = '38en7+KOuYtev3DO1QAWbShR/fsmr9nV3yMYCliyiMQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030