UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ngg98TkYu6Bz2HIKJ/eiWlWSsy71P1jsmj6VSzIH/ZA=' 
WHERE 
  key_id = 'af2d898805daf7de7b37c5036b47fdc007516db79f1cb3d905f3d78332226c24' 
  AND (
    token = 'ngg98TkYu6Bz2HIKJ/eiWlWSsy71P1jsmj6VSzIH/ZA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020