UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0OuosgxwbUPF7valpNNt0uN4uXIK0p8mwTBEdhHvBvc='
WHERE
key_id = 'c830121dc33ae8f5c1a522d9ec5d4616d4ff884b43b577adca326198f226d86f'
AND (
token = '0OuosgxwbUPF7valpNNt0uN4uXIK0p8mwTBEdhHvBvc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)