UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tPXhkTxNMVL+IrZWeV/MFlk+MsK5qLG5sKwmm1xmCW4='
WHERE
key_id = 'ba34bf6531e78c7aa7f3c58f826bf49e94c1101213f4734b7d9061241cfa9d9b'
AND (
token = 'tPXhkTxNMVL+IrZWeV/MFlk+MsK5qLG5sKwmm1xmCW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)