UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uUQ+CJpp0c1JVtZgyICZEHjqYAT5f+CZjpxtbhYm1pY='
WHERE
key_id = 'afb90ba397c6206b1104692530e6091fac40b222356ad2b221496d61838a004b'
AND (
token = 'uUQ+CJpp0c1JVtZgyICZEHjqYAT5f+CZjpxtbhYm1pY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)