UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rZ6+QFh3R+1m65jTASOt+z8M0ejRSvOawqiOuMeoJVg='
WHERE
key_id = 'ff2caf5e8f64c842d644f166a02cf7472949d0a6fa293e7d8ad977a09ae7aac8'
AND (
token = 'rZ6+QFh3R+1m65jTASOt+z8M0ejRSvOawqiOuMeoJVg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)