UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'scTVfNzsg0UlsU/lmP5D2fap9+LviyavrQUXoouFGK4='
WHERE
key_id = 'd3dc0be162bd4947b22a3f5d6c84767afa4050f4541629329ec6363f31b0c866'
AND (
token = 'scTVfNzsg0UlsU/lmP5D2fap9+LviyavrQUXoouFGK4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)