UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kriZKk1WVU5lDHwfi+6NYhVNqMt6b5lwfr9oZDd8rAE=' 
WHERE 
  key_id = 'd9e4570e24294e04721a8b7fe5688389e0448caaef322cbc0059be0b139c9585' 
  AND (
    token = 'kriZKk1WVU5lDHwfi+6NYhVNqMt6b5lwfr9oZDd8rAE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042