UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VhMR+7XmK31tPccH5GsgJ3C9JaDW1ObtRE833erPnU4='
WHERE
key_id = '7659093472bdb8dd577bf79bd073e137b2ea187a9e5a3f74405565547e7ce772'
AND (
token = 'VhMR+7XmK31tPccH5GsgJ3C9JaDW1ObtRE833erPnU4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)