UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sDBnm12Xuy6tMEjEUhflc/wuLRrI/tyrDhnvlU1bPyE='
WHERE
key_id = '8bac1eeeca0b794dd209ce52fccabf783a404c94d4ea307f95ddfce0cb5a8f0f'
AND (
token = 'sDBnm12Xuy6tMEjEUhflc/wuLRrI/tyrDhnvlU1bPyE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)