UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ChHSRUBI7wOvS+k5hEivYVj+naw1uPkVBPvzvVLt8zc='
WHERE
key_id = '566a8208ebcef3eebe9e987cd648aea9e7e502b4dfbf3bdda8e13bbee1f6ad50'
AND (
token = 'ChHSRUBI7wOvS+k5hEivYVj+naw1uPkVBPvzvVLt8zc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)