UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'piA6kwYdg7vvCsFnRi4dbzgHQEBYM1bQVbv4qZ7rOIo='
WHERE
key_id = 'aa8f3f6ffa2286366b2bc3767169cb721d91b07ca000642408ad3d5273256a48'
AND (
token = 'piA6kwYdg7vvCsFnRi4dbzgHQEBYM1bQVbv4qZ7rOIo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)