UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sMp9l07KODuyrX+X1mW2f8TeUZZXTZmAqa4J5aWh0dU='
WHERE
key_id = 'de95c844dbde774122fba1bbaf52e8e7f1848d032310a4bdb83f9d09ed507191'
AND (
token = 'sMp9l07KODuyrX+X1mW2f8TeUZZXTZmAqa4J5aWh0dU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)