UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hI3OmeK2mOXPspCw1+w8eM8kH40qBZ1H1COnuqbkqnQ='
WHERE
key_id = '347263212a7a85ad3c34e9edd1855152675855c4d7e9e62036601b3b910e08a7'
AND (
token = 'hI3OmeK2mOXPspCw1+w8eM8kH40qBZ1H1COnuqbkqnQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)