UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Btd16ZL3oW2SvUoPs4BDNo4BjaVGq/eeMr1miimWVC0='
WHERE
key_id = '9cf7516f03525b8e6ff422507fd1afc409aa321c3800e2c5c93f8f5d4f75584c'
AND (
token = 'Btd16ZL3oW2SvUoPs4BDNo4BjaVGq/eeMr1miimWVC0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)