UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'esmpwDPsDSia17EvQH0MJkeePetvEc7fR2RPE2xkwKA='
WHERE
key_id = '58b2b5b005a82b13a626fccf47706978ba5bd979afe4be2fc162e6a3a343a542'
AND (
token = 'esmpwDPsDSia17EvQH0MJkeePetvEc7fR2RPE2xkwKA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)