UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TtyMLB/KiXsYbQvhrMTMrvpyU9pvHX27obQz3ovc6Q8=' 
WHERE 
  key_id = '878bb0faabab1529f959c3816124938fa991537f0694104b59a8a064168b087a' 
  AND (
    token = 'TtyMLB/KiXsYbQvhrMTMrvpyU9pvHX27obQz3ovc6Q8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029