UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4q0nK6DmwZYmNrhfqQxQuZZLhuRm6ORF3cbqz9gQgDw='
WHERE
key_id = '6e716e35fa16c0cc8a9916c726509aa223a1fe96ceec8320ecec2424fcb08ec6'
AND (
token = '4q0nK6DmwZYmNrhfqQxQuZZLhuRm6ORF3cbqz9gQgDw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)