UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Tew2haCDLS3LYChn8/8jEVDUlAAbmoxWHdkfzE6QsOI='
WHERE
key_id = '7ede12456f2617358c0b1849fc9a7148368bc481a44e577296dd18c70887c73d'
AND (
token = 'Tew2haCDLS3LYChn8/8jEVDUlAAbmoxWHdkfzE6QsOI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)