UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zt9IEQJuEOzeZ7+CYZx1uhKlPGp14ue89Xo1tumc+U4='
WHERE
key_id = '5b4faff1a819fb31f885d680a0b1f70413ea7e3693a75eacadba8ae5197bf0b3'
AND (
token = 'zt9IEQJuEOzeZ7+CYZx1uhKlPGp14ue89Xo1tumc+U4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)