UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8QoHYYGxfWwYN9TtoW6q60PtIsanzK9ZeSUmBf/agxk='
WHERE
key_id = 'fcd47938d4c1951e86aae2ffa43bf6ff74e6ddd3a4bc9f88f835dcf4f34f1499'
AND (
token = '8QoHYYGxfWwYN9TtoW6q60PtIsanzK9ZeSUmBf/agxk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)