UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xPZA+1F8tX2X1LFUcja1DFru2zkACP97fEstCjkis2w='
WHERE
key_id = 'd246f46416eed9a2e6d340647bdf08c7675bf0873eb58a57a088e077a2270a4a'
AND (
token = 'xPZA+1F8tX2X1LFUcja1DFru2zkACP97fEstCjkis2w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)