UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hABFLr/A84/92iXJnjAhA0zu8hTtX5tmyYhAzpyeoGM='
WHERE
key_id = 'c4ffb04fed8dc39962b6d0041faff094fcb506d38ce96402334d5bf4eac9ec55'
AND (
token = 'hABFLr/A84/92iXJnjAhA0zu8hTtX5tmyYhAzpyeoGM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)