UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qEnteB4UA7z4xySVDJwvWlrPZwmMFMGwWeIGK2y2fRg='
WHERE
key_id = '44b3dfcc86832aba23aa7d22787bdb8d06065da70e73734a3443e44024e92d0f'
AND (
token = 'qEnteB4UA7z4xySVDJwvWlrPZwmMFMGwWeIGK2y2fRg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)