UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's++YbFYDpgyKotsVeW8W+Cs7W57RXuMGF6X7so8YPxc=' 
WHERE 
  key_id = 'f20e4b1285bf9de2c9a3a06f65e45f7b1df5d732f08ade5fdd9440d577ea1389' 
  AND (
    token = 's++YbFYDpgyKotsVeW8W+Cs7W57RXuMGF6X7so8YPxc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033