UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AfmPFZEVKpBVHw86Pu85fHSg6oP9hOiI25F4LnTM5hw=' 
WHERE 
  key_id = '1e9806dce677582cc1e103250e0166b081a294a5359dddf7085b7da61d6e60a5' 
  AND (
    token = 'AfmPFZEVKpBVHw86Pu85fHSg6oP9hOiI25F4LnTM5hw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026