UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mFvZqi9epWuMcCnKkBdc82wDVxAKX0ag2/WYNbjhVnY='
WHERE
key_id = 'fe8212b89bcd7465291fa332137d193cc3e08d4e6c8641874c6a8d3787849d3d'
AND (
token = 'mFvZqi9epWuMcCnKkBdc82wDVxAKX0ag2/WYNbjhVnY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)