UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dgICi0CnpAxZgqF/ad00yjeIxKHhtLIIN9difcZOi6o='
WHERE
key_id = 'c44f9a9e31b727a65c24d3f246031ecd38de4ed5b620585ab6c23750270bc3f1'
AND (
token = 'dgICi0CnpAxZgqF/ad00yjeIxKHhtLIIN9difcZOi6o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)