UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kKuUUtCR9nqA166a+eY4maFcSPK1PeTmDGlKTsMu1b8='
WHERE
key_id = '78f42ffeb6de75bfd36e9965a647fb5302ed07bb504d949e1ba8b69562341fd6'
AND (
token = 'kKuUUtCR9nqA166a+eY4maFcSPK1PeTmDGlKTsMu1b8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)