UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cW1lu1JvnfjcUoWUn6KwJgsBuuOMZ/7GV5Iy/jFr1B4='
WHERE
key_id = '70852c4789a4647472dd46d0d4399ab95875d0127c3a5124595d2b379df622b5'
AND (
token = 'cW1lu1JvnfjcUoWUn6KwJgsBuuOMZ/7GV5Iy/jFr1B4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)