UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OpQpBrGA2q0YriZYHz3VRmmtel/9xi2iF5hoQ+VrKxY=' 
WHERE 
  key_id = '208c2554bd70cba3b2670e7359220f3dcb2804f97b8b631403f0067ea1b0b2ed' 
  AND (
    token = 'OpQpBrGA2q0YriZYHz3VRmmtel/9xi2iF5hoQ+VrKxY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023