UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dqctmV3SjCiStEtlkpNzLhCpzOjPAPDfvgFa5cs0sU0='
WHERE
key_id = '8f6520a17ed58eff0473b70436358e52413c97db4ffa261838bc5b99257a23b3'
AND (
token = 'dqctmV3SjCiStEtlkpNzLhCpzOjPAPDfvgFa5cs0sU0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)