UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D6ZcTmk5fFi9SsgJ7x2GuPT9G6m7g5CBSVDg2xjEMAs='
WHERE
key_id = '58d008707afc3c799e38fffc5fa9f389d15cbcb02723197762c23bdc5c94b1b6'
AND (
token = 'D6ZcTmk5fFi9SsgJ7x2GuPT9G6m7g5CBSVDg2xjEMAs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)