UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9g9IiJbbYFbeCc7fOXu4r5E+mJUnJpq+d9y6Ks318Wo=' 
WHERE 
  key_id = 'b1671e0a44eb3576179764689f29236d5b05199ddff789418a5d94451533db3a' 
  AND (
    token = '9g9IiJbbYFbeCc7fOXu4r5E+mJUnJpq+d9y6Ks318Wo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032