UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KrIlch3orVmgd/GieUg5sYypWtbTQPZMNiVYHGqwTyg='
WHERE
key_id = '1b072b9cc7537fddc4e0bdcd3614d267d8f983f5a6435daa94141c9b4219a305'
AND (
token = 'KrIlch3orVmgd/GieUg5sYypWtbTQPZMNiVYHGqwTyg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)