UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0uB1+Gm/4xhTM5fOMrlwv/NXgy8ehhCwAhMDJwOIil0='
WHERE
key_id = '5c66ccbfcdd4c9f6c20ce6da91c81e5569827d1066e06cec2cf7f331b9c976a8'
AND (
token = '0uB1+Gm/4xhTM5fOMrlwv/NXgy8ehhCwAhMDJwOIil0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)