UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TgcIKRr3iUERaDsYHMm1dYYtzYgTtKICWgKkS5mQUug='
WHERE
key_id = '6a1bbc35e64585571ebc6fe18d856508c4edfa1a351089d4af83de529f5816cb'
AND (
token = 'TgcIKRr3iUERaDsYHMm1dYYtzYgTtKICWgKkS5mQUug='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)