UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c647/TF8htFVE8VANw5T3VAd8K2rzYUAxqKcjYvyim4='
WHERE
key_id = 'd2b5d15b26c60f8dc4c5ea374bc9ae203478f1b8195c46869b3e62804e6a9d74'
AND (
token = 'c647/TF8htFVE8VANw5T3VAd8K2rzYUAxqKcjYvyim4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)