UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bC32Nvo3pqA9oMdCKbsMRuQUxwSE3/v+QWywB3+uBbQ='
WHERE
key_id = 'ed4d52bee6cc48f46df31ef97715b2b04e561c185d1cb2d8687870a515a367f0'
AND (
token = 'bC32Nvo3pqA9oMdCKbsMRuQUxwSE3/v+QWywB3+uBbQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)