UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kZiyV+dK9H/jEA2+ICYzV+XKYBBeOVRDuJKk8xcavGs='
WHERE
key_id = 'b40dd11eef68a6d36a61948cb00a5d591467d51461d7b45d84fb8eff1743d8d2'
AND (
token = 'kZiyV+dK9H/jEA2+ICYzV+XKYBBeOVRDuJKk8xcavGs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)