UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uQw/6qpus/Zx6rCRRKSDyAyw5LOaECkpcKjnR+HL9Dw='
WHERE
key_id = 'd18dac654bae381f5f9941bb6f4103bdb4fdc39802e0fa7f4c9a44f36e56635f'
AND (
token = 'uQw/6qpus/Zx6rCRRKSDyAyw5LOaECkpcKjnR+HL9Dw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)